#ifndef ANIMATIONMANAGER_H
#define ANIMATIONMANAGER_H

#include "yamlstream.h"
#include <Shinygami/datafile.hpp>
#include "texturemanager.h"
#include <QDebug>

class AnimationManager : public QObject
{
    Q_OBJECT
public:
    struct Pair : public QPair<QString, Shiny::SpriteAnimate::Animation>
    {
	QString textureName;
    };

    Pair* GetDataByName(const QString& name);

    Shiny::SpriteAnimate::Animation* GetByName(const QString& name);
    const Shiny::SpriteAnimate::Animation* GetByName(const QString& name) const;
    void        Load(const QString& filepath, TextureManager* tm);
    void        Save(const QString& file, TextureManager* tm);
    void        Clear(void) { _animations.clear(); }
    void        LoadAnimation(Data data, TextureManager* tm);
    void        SaveAnimation(YamlStream& stream, TextureManager* tm, Pair anim);
signals:
    void        AnimationAdded(QString);
    void        AnimationDeleted(QString);

public slots:
    void        AddAnimation(QString);
    void        DeleteAnimation(QString);

private:
    QList<Pair>     _animations;
    TextureManager* _tm;
};

#endif // ANIMATIONMANAGER_H
